home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / September 93.iso / Archives / Applications / Graphics / image / VisionLab / shared.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-01  |  4.9 KB  |  141 lines  |  [TEXT/KAHL]

  1. /*    PROCs that operate on the PixMap or the PixMap's clut must have resource
  2.     IDs of 1000, 1020, 1040,... 1580.  PROCs that operate on the BitMap must
  3.     have resource IDs of 2000, 2020, 2040,... 2580.  The BitMap is assumed to
  4.     have the same dimentions as the PixMap.  All PROCs all called with a pointer
  5.     to the following data struct:
  6. */
  7.  
  8. typedef struct {
  9.     PixMapPtr pixMapPtr;            /*    pixMapPtr points to the PixMap struct
  10.                                         in memory.  (See Inside Mac V for the
  11.                                         description of a PixMap struct).
  12.                                     */
  13.     BitMap *bitMapPtr;                /*    bitMapPtr points to the BitMap struct
  14.                                         in memory.    (See Inside Mac I for the
  15.                                         description of a BitMap struct).  The
  16.                                         BitMap will initially be set to all
  17.                                         white by Vision Lab on the first call
  18.                                         to a BitMap PROC.
  19.                                     */
  20.     unsigned char *grayMapPtr;        /*    grayMapPtr is an array of 256 chars in
  21.                                         memory that map a pixel value to it's
  22.                                         gray level value.  For example: in 4
  23.                                         bit deep PixMap there might be a pixel
  24.                                         with a value of 13.  To find out what
  25.                                         gray level this really is we look at
  26.                                         the value stored at *(grayMapPtr+13).
  27.                                         This will be a value from 0 to 255. 0
  28.                                         is black and 255 is white.
  29.                                     */
  30.     Rect selRect;                    /*    selRect is the rectangle that has been
  31.                                         selected on the screen.  If no selection
  32.                                         is present then selRect is equal to the
  33.                                         dimensions of the PixMap.
  34.                                     */
  35.     int minPixSize;                    /*    minPixSize is the minimum bits needed
  36.                                         per pixel.  For example: an 8 bit deep
  37.                                         PixMap may only really contain 5 bits
  38.                                         of information.
  39.                                     */
  40.     char BitsChanged : 1;            /*    This flag MUST be set if you change
  41.                                         any bits in the BitMap.
  42.                                     */
  43.     char PixsChanged : 1;            /*    This flag MUST be set if you change
  44.                                         any pixels in the PixMap.
  45.                                     */
  46.     char ClutChanged : 1;            /*    This flag MUST be set if you change
  47.                                         the clut of the PixMap.
  48.                                     */
  49.     char filler1 : 5;                /*    Reserved for future use - do not change!
  50.                                     */
  51.     int ProcResID;                    /*    The resource ID of the PROC being called.
  52.                                         If a PROC needs any private resources
  53.                                         they should be numbered from XXXX to XX99.
  54.                                         Where XXXX is the PROCs resource ID.
  55.                                     */
  56.     Handle PixHand;                    /*    Handle to the pixel image in memory.  The
  57.                                         handle is locked when passed to outside
  58.                                         PROCs and the dereferenced pointer is stored
  59.                                         in the PixMap */
  60.     Handle BitHand;                    /*    Handle to the bit image in memory.  The
  61.                                         handle is locked when passed to outside
  62.                                         PROCs and the dereferenced pointer is stored
  63.                                         in the BitMap */
  64.     unsigned long *tSizePtr;        /*    Total size for bar graph procedure */
  65.     unsigned long *pSizePtr;        /*    Processed size for bar graph procedure */
  66.     long filler[28];                /*    reserved for future use */
  67.     
  68.     /* -=[]=--=[]=--=[]=--=[]=--=[]=--=[]=--=[]=--=[]=--=[]=--=[]=--=[]=--=[]=--=[]=-*/
  69.     
  70.     int (*getAPixel)();                /*    getAPixel(x, y, mapPtr)
  71.                                         int x, y;
  72.                                         PixMapPtr mapPtr;
  73.                                         {
  74.                                         }
  75.                                         
  76.                                         Gets a pixel value from either a BitMap or a
  77.                                         PixMap.  WARNING!!! No range checking is done on
  78.                                         input values!
  79.                                     */
  80.     void (*setAPixel)();            /*    setAPixel(x, y, mapPtr, value)
  81.                                         int x, y;
  82.                                         PixMapPtr mapPtr;
  83.                                         int value;
  84.                                         {
  85.                                         }
  86.                                         
  87.                                         Sets a pixel in either a BitMap or a PixMap to
  88.                                         value.  WARNING!!! No range checking is done on
  89.                                         input values!
  90.                                     */
  91.     void (*doGM)();                    /*    Position, theEvent, map, data)
  92.                                         Point Position;
  93.                                         EventRecord *theEvent;
  94.                                         unsigned char *map;
  95.                                         MapDataPtr data;
  96.                                         {
  97.                                         }
  98.                                         
  99.                                         Does a gray map… more on this later.
  100.                                     */
  101.     void (*updateBarGraph)();        /*    updateBarGraph()
  102.                                         {
  103.                                         }
  104.                                         
  105.                                         Call this to draw the bar graph periodically
  106.                                     */
  107.     void (*setupBarGraph)();        /*    setupBarGraph(theText)
  108.                                         StringPtr theText;
  109.                                         {
  110.                                         }
  111.                                         
  112.                                         Call this to initialize the bar graph.  theText
  113.                                         will be placed inside the bar graph and should
  114.                                         say what exactly is taking so long to do.
  115.                                     */
  116.     void (*killBarGraph)();            /*    killBarGraph()
  117.                                         {
  118.                                         }
  119.                                         
  120.                                         You *MUST* call this when when you are finished
  121.                                         with the bar graph!
  122.                                     */
  123. } Share, *SharePtr;
  124.  
  125. typedef struct {
  126.     int lastX;
  127.     int lastY;
  128.     unsigned char brightness;
  129.     unsigned char contrast;
  130. } MapData, *MapDataPtr;
  131.  
  132. #define        getAPixelM            (*AppDataPtr->getAPixel)
  133. #define        setAPixelM            (*AppDataPtr->setAPixel)
  134. #define        doGMM                (*AppDataPtr->doGM)
  135. #define        updateBarGraphM        (*AppDataPtr->updateBarGraph)
  136. #define        setupBarGraphM        (*AppDataPtr->setupBarGraph)
  137. #define        killBarGraphM        (*AppDataPtr->killBarGraph)
  138.  
  139. #define        pSizeM                (*(AppDataPtr->pSizePtr))
  140. #define        tSizeM                (*(AppDataPtr->tSizePtr))
  141.